Add poethepoet config#1976
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1976 +/- ##
===========================================
+ Coverage 51.26% 52.08% +0.82%
===========================================
Files 39 43 +4
Lines 3938 4091 +153
Branches 488 503 +15
===========================================
+ Hits 2019 2131 +112
- Misses 1791 1830 +39
- Partials 128 130 +2 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
|
||
| - name: Test with pytest | ||
| run: uv run pytest -v --cov-report=xml --junitxml=junit.xml -o junit_family=legacy | ||
| run: uv run poe test-py${{ matrix.python-version }} -v --cov-report=xml --junitxml=junit.xml -o junit_family=legacy |
There was a problem hiding this comment.
Will this make it more verbose since the commands in pyproject.toml also include -v?
There was a problem hiding this comment.
You are right. The -v is doubled. I removed the -v in the .yml.
There was a problem hiding this comment.
Pull request overview
This PR replaces ad-hoc local/CI developer commands with centralized poethepoet tasks in pyproject.toml, so Bleak’s linting, testing, type checking, and docs workflows can be run consistently through uv run poe ....
Changes:
- Add
poethepoetas a development dependency and define sharedpoetasks for tests, linting, type checking, and docs. - Update GitHub Actions workflows to invoke the new
poetasks instead of duplicating shell commands. - Refresh contributor instructions and Alpine VM setup to support the new task-based workflow.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Locks poethepoet and its transitive dependencies for the dev environment. |
pyproject.toml |
Adds poethepoet, updates mypy/pytest config, and defines the new shared task runners. |
CONTRIBUTING.rst |
Switches contributor guidance to the new uv run poe ... commands. |
.github/workflows/format_and_lint.yml |
Replaces direct lint/docs commands with centralized poe tasks. |
.github/workflows/build_and_test.yml |
Reworks CI test and typecheck execution to use the new poe task definitions. |
.github/alpine-vm/start-alpine-vm.sh |
Adds git to the Alpine VM packages to support the updated CI execution path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| VM_SSH_PORT="2222" | ||
| VM_CONSOLE_LOG="vm-console.log" | ||
| VM_PACKAGES="bluez openssh uv" | ||
| VM_PACKAGES="bluez openssh uv git" |
There was a problem hiding this comment.
No, that isn't strictly necessary for poe. But during the development of my poe PR, I installed poe directly from a Git branch, and that only works if Git is also installed on the system. Since Git is also listed as a prerequisite in CONTRIBUTING.rst, I just left it in there so people don't run into that issue again.
| { cmd = "flake8 . --count --show-source --statistics", executor = { group = "lint" } }, | ||
| ] | ||
| args = [{ name = "checkonly", type = "boolean" }] | ||
| executor = { group = "lint" } |
There was a problem hiding this comment.
If we have this here, do we need the same on each command in the sequence?
There was a problem hiding this comment.
The executor option in sequence tasks does not seem to have any effect. In other words, it is not passed on to the child tasks. Therefore, the executor must be explicitly specified in each of the cmd tasks. While the poethepoet documentation does not mention this, I discovered it through experimentation.
During testing, I also noticed that with the --group "test" executor option, all dev dependencies are still installed, since dev is installed by default unless you explicitly exclude it using --no-group "dev". To avoid installing all the unnecessary dependencies, I therefore added --no-group "dev" everywhere as well.
…tion in lint sequence task
|
Thanks! |
This is an alternative to #1922 that uses
poethepoetinstead oftoxas you suggested.Some examples of the new commands:
uv run poe test-py310: Run pytest on Python 3.10uv run poe test-py310 --bleak-hci-transport=serial:/dev/tty.usbmodem1101: Run integration tests on Python 3.10uv run poe test-all: Run pytest on all Python versionsuv run poe test-all --bleak-hci-transport=serial:/dev/tty.usbmodem1101: Run integration tests on all Python versionsuv run poe lint: Run code linters (isort, black, flake8)uv run poe lint --checkonly: Run code linters (isort, black, flake8) without changing anything (mainly for CI usage)uv run poe typecheck: Run type checkers (mypy, pyright)uv run poe docs: Building the docsThis is only the groundwork for all current functions of bleak. I plan to expand the poethepoet config in #1944 to add "cross-platform" type checking for the new Android backend. And additionaly in #1853 to add type checking for multiple backends (
pyobjcandrubicon-objc).It took some time to find a good way to pass the
--bleak-hci-transportor--bleak-bluez-vhcioptions to the pytests. Finally I created nat-n/poethepoet#380 that simplifies this problem an which is now released in poethepoeth v0.45.0.